<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新增云通讯用户</title>
<jsp:include page="/commons/common-js.jsp"></jsp:include>
</head>
<body>
<div style="padding:10px 10px 10px 10px">
	<form id="adminAddForm" class="viewPointForm" method="post">
		<input type="hidden" name="viewId"/>
	    <table cellpadding="5">
	        <tr>
	            <td>账号:</td>
	            <td><input class="easyui-textbox" type="text" name="username" data-options="required:true" style="width: 280px;"></input></td>
	        </tr>
	        <tr>
	            <td>密码:</td>
	            <td><input class="easyui-textbox" type="text" name="password" data-options="required:true" style="width: 280px;"></input></td>
	        </tr>
	         <tr>
	            <td>姓名:</td>
	            <td><input class="easyui-textbox" type="text" name="certName" data-options="required:true" style="width: 280px;"></input></td>
	        </tr>
	    </table>
	</form>
	<div style="padding:5px">
	    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitFormadd()">提交</a>
	    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">重置</a>
	</div>
</div>
<script type="text/javascript">
	//提交逻辑
	function submitFormadd(){
		//校验
		if(!$('#adminAddForm').form('validate')){
			$.messager.alert('提示','表单还未填写完成!');
			return ;
		}
		/* var herdimg = $('#herdImg').val();
		alert(herding);
		if(herdimg == ""){
			$.messager.alert('提示','景点头图尚未上传!');
			return ;
		} */
		/* contentAddEditor.sync(); */
		
		//提交到后台的RESTful
		$.ajax({
		   type: "POST",
		   url: "${pageContext.request.contextPath}/admin/add",
		   data: $("#adminAddForm").serialize(),
		   success: function(data){
			   if(data.status == '000'){
				   $.messager.alert('提示','开通新用户成功!','info',function(){
						$("#adminAddWindow").window('close');
						$("#adminList").datagrid("reload");
/* 					    input.parent().find("img").remove(); */
					    clearForm();
					});
				}else if(data.status == '001'){
					$.messager.alert('系统提示',data.msg);
					
				}else if(data.status == '002'){
					$.messager.alert('系统提示',data.msg);
				}
			   
		   },
		   error: function(){
			   $.messager.alert('提示','新增用户失败!');
		   }
		});
	}
	
	function clearForm(){
		$('#adminAddForm').form('reset');
	}
			
			
</script>
</body>
</html>